﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    $(function () {
        gridList();
    })
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/Gas/ChargeRecord/GetGridJsonByTypeAndStatus",
            height: $(window).height() - 96,
            colModel: [
                { label: "主键", name: "F_Id", hidden: true, key: true },
                { label: '充装公司', name: 'CompanyName', width: 200, align: 'left' },
                { label: '加气枪', name: 'DeviceName', width: 100, align: 'left' },


                { label: '车牌号', name: 'PlateNumber', width: 80, align: 'left' },
                { label: '记录类别', name: 'ChargeType', width: 150, align: 'left' },
                {
                    label: '充装时间', name: 'ChargeDate', width: 130, align: 'left'
                },
                { label: '记录状态', name: 'RecordStatus', width: 80, align: 'left' }
            ],
            pager: "#gridPager",
            sortname: 'ChargeDate desc',
            viewrecords: true,
            postData: { chargeType: "异常充装", recordStatus: "申请决定意见" }
        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { keyword: $("#txt_keyword").val() },
            }).trigger('reloadGrid');
        });
    }
    function btn_details() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: "Details",
            title: "查看记录",
            url: "/Gas/ChargeRecord/Details?keyValue=" + keyValue,
            width: "550px",
            height: "700px",
            btn: null,
        });
    }
    function btn_punish() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalConfirm("确定【处罚】？", function (r) {
            if (r) {
                $.submitForm({
                    url: "/Gas/ChargeRecord/Punish",
                    param: { recordid: keyValue },
                    success: function () {
                        $.currentWindow().$("#gridList").trigger("reloadGrid");
                    }
                })
            }
        });
    }
    function btn_clear() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalConfirm("确定【处理消除】？", function (r) {
            if (r) {
                $.submitForm({
                    url: "/Gas/ChargeRecord/Clear",
                    param: { recordid: keyValue },
                    success: function () {
                        $.currentWindow().$("#gridList").trigger("reloadGrid");
                    }
                })
            }
        });
    }
</script>

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>

        <div class="operate">
            <ul class="nav nav-pills">
                <li class="first">已选中<span>1</span>项</li>
                <li><a id="NF-RecordImages" authorize="yes" onclick="btn_details()"><i class="fa fa-pencil-square-o"></i>查看记录</a></li>
                <li class="split"></li>
                <li><a id="NF-punish" authorize="yes" onclick="btn_punish()"><i class="fa fa-hand-o-right"></i>处罚</a></li>
                <li><a id="NF-clear" authorize="yes" onclick="btn_clear()"><i class="fa fa-hand-paper-o"></i>处理消除</a></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="企业名称" style="width: 200px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>
